/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package panel;

import java.awt.Dimension;
import java.awt.Image;
import javax.swing.ImageIcon;

/**
 *
 * @author jerry
 */
public class MeMsgBoxPanel extends javax.swing.JPanel {

    /**
     * Creates new form MeMsgBoxPanel
     *
     * @param msg_textString 消息内容
     * @param use_face_iamge
     */
    public MeMsgBoxPanel(String msg_textString, Image use_face_iamge) {
        initComponents();

        msg_text.setText(msg_textString);
        face_image.setIcon(new ImageIcon(use_face_iamge));
 
    }

    /**
     * 获得文本框的大小
     *
     * @return
     */
    public int GetMsgSize() {
        return msg_text.getLineCount() * 20+20;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        face_image = new javax.swing.JLabel();
        msg_text = new javax.swing.JTextArea();

        setPreferredSize(new java.awt.Dimension(567, 0));

        msg_text.setEditable(false);
        msg_text.setBackground(new java.awt.Color(178, 226, 129));
        msg_text.setColumns(20);
        msg_text.setLineWrap(true);
        msg_text.setRows(5);
        msg_text.setWrapStyleWord(true);
        msg_text.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(178, 226, 129), 5, true));
        msg_text.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        msg_text.setEnabled(false);
        msg_text.setSelectionColor(new java.awt.Color(0, 0, 0));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(213, Short.MAX_VALUE)
                .addComponent(msg_text, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(face_image, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(face_image, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(msg_text, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JLabel face_image;
    private javax.swing.JTextArea msg_text;
    // End of variables declaration//GEN-END:variables
}
